package io.datajek.spring.basics.movierecommendersystem.partone.eleven;

import io.datajek.spring.basics.movierecommendersystem.partone.nine.Movie;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

import java.util.Arrays;

@SpringBootApplication
public class MovieRecommenderSystemApplication {

    public static void main(String[] args) {

        //ContentBasedFilter contentBasedFilter = new ContentBasedFilter();

        //SpringApplication.run(MovieRecommenderSystemApplication.class, args);

        //使用ApplicationContext来查找正在使用的过滤器
        ApplicationContext applicationContext = SpringApplication.run(MovieRecommenderSystemApplication.class,args);

        //创建 RecommenderImplementation 类的对象
        RecommenderImplementation recommender = applicationContext.getBean(RecommenderImplementation.class);
        System.out.println();
        System.out.println();
        System.out.println(recommender);

        //从Application Context中两次获得Prototype Bean
        System.out.println();
        Movie m1 = applicationContext.getBean(Movie.class);
        System.out.println(m1);

        System.out.println();
        Movie m2 = applicationContext.getBean(Movie.class);
        System.out.println(m2);



        //创建 RecommenderImplementation 类的对象
        //RecommenderImplementation recommender = new RecommenderImplementation();


        String[] result = recommender.recommendMovies("Finding Dory");

        System.out.println(Arrays.toString(result));



    }
}
